<!--
 * @Author: underMoonzs 1994186472@qq.com
 * @Date: 2025-08-25 22:31:04
 * @LastEditors: underMoonzs 1994186472@qq.com
 * @LastEditTime: 2025-10-05 17:13:58
 * @FilePath: \lyshjpt\src\views\biz\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="biz-container">
    <!-- <el-header height="80px" class="header">
      <div class="header-content">
        <h1 class="header-title">水生态环境一张图</h1>
       <div class="map-navigation">
          <div class="map-icon" @click="navigateToMap">
            <img src="@/assets/map/navigate/数据驾驶舱1.png" alt="地图导航" class="map-icon-img" />
          </div>
        </div>
      </div>
    </el-header> -->

    <el-main class="main-content">
      <LayerTree @layer-change="handleLayerChange" />
      <MapContainer ref="mapContainer" />
      <Legend />
    </el-main>
  </div>
</template>

<script>
import LayerTree from './components/LayerTree'
import MapContainer from './components/MapContainer'
import Legend from './components/Legend'
export default {
  name: 'BizIndex',
  components: {
    LayerTree,
    MapContainer,
    Legend
  },
  data() {
    return {
      activeLayers: []
    }
  },
  methods: {
    navigateToMap() {
      this.$router.push('/jiashicang');
    },
    // 示例：直接调用MapContainer组件的方法
    callMapUpdateLayers(layers, activeLayer) {
      this.$refs.mapContainer.updateLayers(layers, activeLayer);


    },
    handleLayerChange(layers, activeLayer) {
      this.callMapUpdateLayers(layers, activeLayer);
    },
  }
}
</script>

<style scoped>
.biz-container {
  height: calc(100vh - 105px);
  background-color: #f5f7fa;
  display: flex;
  flex-direction: column;
}

.main-content {
  padding: 0;
  flex: 1;
  overflow: hidden;
}


/* ===== 头部样式 ===== */
.header {
  /* background: linear-gradient(to right, #2c3e50, #34495e);*/
  background: #307eff;
  color: white;
  padding: 0;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  flex-shrink: 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  padding: 0 20px;
}

.header-title {
  flex: 1;
  text-align: left;
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: white;
}

.map-navigation {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.map-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  /* 修改为矩形样式，移除圆形边框 */
  border-radius: 8px;
  background-color: #409EFF;
  transition: all 0.3s;
  padding: 4px;
  width: 60px;
  height: 60px;
}

.map-icon:hover {
  background-color: #66b1ff;
  /* 移除缩放效果，保持矩形外观 */
  transform: none;
}

.map-icon-img {
  width: 100%;
  height: 100%;
}
</style>